import json

# 定义全局变量config_path
# config_path = os.path.join(os.path.dirname(__file__), 'config.json')
config_path = 'config.json'


# 加载配置文件
def load_config():
    with open(config_path, 'r') as file:
        return json.load(file)


# 全局配置字典
GLOBAL_CONFIG = load_config()


# 配置类定义
class SeleniumConfig:
    config = GLOBAL_CONFIG.get('selenium', {})
    timeout = config.get('timeout')
    interval = config.get('interval')
    simpleTime = config.get('simpleTime')
    uploadTimeout = config.get('uploadTimeout')
    loginTimeout = config.get('loginTimeout')
    attempts = config.get('attempts')
    attemptWaitTime = config.get('attemptWaitTime')
    scanningCodeTime = config.get('scanningCodeTime')
    browserStart = config.get('browserStart')


class ChromeConfig:
    config = GLOBAL_CONFIG.get('chrome', {})
    chromeDataPathAndPrefix = config.get('chromeDataPathAndPrefix')
    chrome_path = config.get('chrome_path')
    monitor_popups = config.get('monitor_popups')


class MainConfig:
    config = GLOBAL_CONFIG.get('main_function', {})
    baseUrl = config.get('baseUrl')
    logPath = config.get('logPath')
    cachePath = config.get('cache')
    polling_interval = config.get('polling_interval')
    monitor_interval = config.get('monitor_interval')
    notification = config.get('notification')


class WifiConfig:
    config = GLOBAL_CONFIG.get('wifi', {})
    WIFI_TIMEOUT = config.get('WIFI_TIMEOUT')
    WIFI_INTERVAL = config.get('WIFI_INTERVAL')
    INTERNET_TIMEOUT = config.get('INTERNET_TIMEOUT')
    WIFI_PASSWORD = config.get('WIFI_PASSWORD')
